<template>
    <div class="user-list-box">
        <yx-table
            :is-fit="false"
            :table-data="tableData"
            :columns="columns"
            :page-obj="pageObj"
            :loading="loading"
            :tableHeightDefault="700"
        >
        </yx-table>
    </div>
</template>

<script>
import yxTable from '../../../../components/yxtable/yx-table'
export default {
    components: {
        yxTable
    },
    name: 'userList',
    props: {
    },
    data() {
        return {
            columns: [
                {label: '用户姓名', prop: 'patientName'},
                {label: '性别', slot: 'patientSex'},
                {label: '年龄', prop: 'patientAge'},
                {label: '联系电话', prop: 'patientPhone'},
                {label: '咨询时间', prop: 'createTime'},
                {label: '证件号码', prop: 'patientIdcard'},
                {label: '用户来源', prop: 'relationType'},
            ], // 操作列
            loading: false,
            pageObj: {
                size: 10,
                total: 0,
                currentPage: 1,
                func: (currentPage) => {
                    this.pageTurning(currentPage)
                },
                handleSizeChange: (size) => {
                    this.sizeChange(size)
                }
            },
            tableData: [],
        }
    },
    mounted() {
        this.getMysubscriber();
    },
    methods: {
        pageTurning(currentPage) {
            this.pageObj.currentPage = currentPage;
            this.getMysubscriber();
        },
        sizeChange(size) {
            this.pageObj.size = size;
             this.getMysubscriber();
        },
        getMysubscriber() {
            this.loading = true;
            let params= {
                current: this.pageObj.currentPage,
                size: this.pageObj.size,
                // maxTime: this.time[1],
                // minTime: this.time[0],
                // name: this.name,
                // phone: this.phone
            }
            this.$ajax.getMysubscriber(params).then(res => {
                this.loading = false;
                let {code, data} = res;
                if(code === 1) {
                    this.tableData = data.list
                    this.pageObj.total = data.total
                }
                // console.log(data)
                }).catch(err => {
                    this.loading = false;
                });
        }
    }
}
</script>

<style lang='scss'>
</style>
